home *** CD-ROM | disk | FTP | other *** search
- Path: mailhost.mwmicro.com!news
- From: aschlies@citynet.net (Tony Schliesser)
- Newsgroups: comp.lang.c
- Subject: returning a string from a function
- Date: Fri, 12 Jan 1996 05:01:53 GMT
- Organization: MidWest Micro
- Message-ID: <4d4uh8$q46@mailhost.mwmicro.com>
- Reply-To: aschlies@citynet.net
- NNTP-Posting-Host: pd011.mwmicro.com
- X-Newsreader: Forte Agent .99c/32.126
-
- I am learning C with the aid of only a book. I am at an inpass in
- this process. I have a small function that needs to return a string
- back to the main routine. I have the following prototype:
-
- char function_name(char in_string[80])
-
- {
- char value[80];
-
- ...value takes on part of the value of the last 10 characters
- of in_string.
-
- return(value);
- }
-
-
- jWhen this function is done, it only returns the first character. I
- "watched" the program execution and it shows that value indeed has the
- last 10 characters. Any clues as to why the calling routine only gets
- the one character??
-
- Also, I wrote the routine that copies the last 10 characters. Is there
- a lib. function that does that for me?? Did I reinvent the wheel?
-
- Thanks for your patients.
-
- Tony
-
-